package com.fyl.oauth2.service.impl;

import com.fyl.oauth2.domain.SOSUserDetails;
import com.fyl.oauth2.entity.User;
import com.fyl.oauth2.dao.UserMapper;
import com.fyl.oauth2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @Author: 黯然
 * @Date: 2025/4/8 16:10
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

        User user = userMapper.selectByUserId(username);
        SOSUserDetails userDetails = new SOSUserDetails(user);


        return new SOSUserDetails(user);
    }
}
